<form action="{:sysuri()}" method="post" data-auto="true" class="layui-form layui-card" data-table-id="BaseTable">

    <div class="layui-card-body padding-left-40">
        {if !isset($vo.code)}
        <div class="layui-form-item">
            <label class="layui-form-label label-required">{:lang('配置类型')}</label>
            <div class="layui-input-block">
            <select class="layui-select" disabled>
                <option value=''>{:lang('请选择')}</option>
                {foreach $types as $code => $typeName}
                {if $code eq input('get.type')}
                <option selected value="{$code}">{$typeName}</option>
                {else}
                <option value="{$code}">{$typeName}</option>
                {/if}
                {/foreach}
            </select>
            <input maxlength="500" class="layui-input" type='hidden' name="type" value='{$type}' required>
            </div>
        </div>
        {/if}

        <div class="layui-form-item">
            <label class="layui-form-label label-required">{:lang('配置分组')}</label>
            <div class="layui-input-block">
                <select class="layui-select" {if isset($vo.group)} disabled {/if} name="group">
                    <option value=''>{:lang('请选择')}</option>
                    {foreach $group as $group_code => $group_name}
                    {if isset($vo.group) && ($vo.group eq $group_code)}
                    <option selected value="{$group_code}">{$group_name}</option>
                    {else /}
                    <option value="{$group_code}">{$group_name}</option>
                    {/if}
                    {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label label-required">{:lang('参数名称')}</label>
            <div class="layui-input-block">
                <input maxlength="500" class="layui-input" name="name" value='{$vo.name|default=""}' required
                       vali-name="{:lang('参数名称')}" placeholder="{:lang('请输入参数名称 例:用户编码')}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label label-required">{:lang('参数变量')}</label>
            <div class="layui-input-block">
                {if isset($vo.code)}
                <input readonly maxlength="100" class="layui-input think-bg-gray" name="code" value='{$vo.code|default=""}'
                       required required-error="{:lang('参数变量不能为空')}" placeholder="{:lang('请输入参数变量 例:user_code')}">
                {else}
                <input maxlength="100" class="layui-input" name="code" value='{$vo.code|default=""}' required
                       vali-name="{:lang('参数变量')}" placeholder="{:lang('请输入参数变量 例:user_code')}">
                {/if}
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label label-required">{:lang('表单类型')}</label>
            <div class="layui-input-block">
                <select class="layui-select" name="form_type" required>
                    <option value=''>{:lang('请选择')}</option>
                    {foreach $formTypeItems as $form_type_items_code => $form_type_items_name}
                    {if isset($vo.form_type) && $vo.form_type eq $form_type_items_code}
                    <option selected value="{$form_type_items_code}">{$form_type_items_name}</option>
                    {else}
                    <option value="{$form_type_items_code}">{$form_type_items_name}</option>
                    {/if}
                    {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label label-required">{:lang('配置简介')}</label>
            <div class="layui-input-block">
                <input class="layui-input" name="desc" value='{$vo.desc|default=""}' required placeholder="{:lang('请输入配置简介')}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label ">{:lang('配置参数')}</label>
            <div class="layui-input-block">
                <textarea name="parameter" class="layui-textarea" placeholder="{:lang('请输入参数 例:1=>白色,2=>蓝色,3=>黄色')} ">{$vo.parameter|default=''}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label ">{:lang('验证规则')}</label>
            <div class="layui-input-block">
                <input maxlength="500" class="layui-input" name="required" value='{$vo.required|default=""}'
                       vali-name="{:lang('验证规则')}" placeholder="{:lang('请输入验证规则 例: required|phone')}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label ">{:lang('默认值')}</label>
            <div class="layui-input-block">
                <textarea name="default_value" class="layui-textarea" placeholder="{:lang('请输入默认值 下拉框、单选框填对应的key值；多图地址用|分割；多选框填对应key值数组 例')}：['1','2']">{$vo.default_value|default=""}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">{:lang('排序')}</label>
            <div class="layui-input-block">
                <input type="number" class="layui-input" name="sort" value='{$vo.sort|default=0}' placeholder="{:lang('请输入序号')}">
            </div>
        </div>
    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>{:lang('保存数据')}</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="{:lang('确定要取消编辑吗？')}" data-close>{:lang('取消编辑')}</button>
    </div>

</form>